#pragma once
#include "d3dutil.h"
#include "LevelElement.h"
#include "Vertex.h"
#include <vector>

class Building;
class PathFinding;
class Soldier;
class SpikeySphere;
class Level;
class ObjMesh;

using namespace std;



//-----------------------------------------------------
// Interface Class									
//-----------------------------------------------------
class AI
{
public:
	AI(ContentManager *ContentManager, Level* level);				// Constructor
	virtual ~AI();		// Destructor

	void Initialize(ObjMesh* tower, ObjMesh* harvester, ObjMesh* house, ObjMesh* main, ObjMesh* barracks);
	void Draw(const RenderContext* pRenderContext);

	void SetEnemyBuildingList(vector<Building*> BuildinglistEnemy) {m_BuildinglistEnemy = BuildinglistEnemy;};
	void SetEnemySoldierList(vector<Soldier*> SoldierEnemylist) {m_SoldierEnemylist = SoldierEnemylist;};

	bool SeeIfFree();

	vector<Building*> GetBuildingList() {return m_Buildinglist;};
	vector<Soldier*> GetSoldierList() {return m_Soldierlist;};
	vector<vector<Soldier*>> GetSoldierAttackingList() {return m_SoldierAttackinglist;};

	void Tick(const InputState & refInputState);
	void StartAttackSoldiers();
	void UpdateAttack(const InputState & refInputState);
	void MoveHarvester();
	void CheckForRemove();
	void CheckDefence(const InputState & refInputState);
	bool GetIfDefeated();

private: 
	//-------------------------------------------------
	// Datamembers							
	ContentManager *m_pContentManager;
	Level* m_pLevel;

	vector<PathFinding*> m_HarvesterPathList;

	Building* m_Barracks;
	ObjMesh* m_TowerMesh, *m_HarvesterMesh, *m_HouseMesh, *m_MainMesh, *m_BarracksMesh;

	vector<Building*> m_Buildinglist;
	vector<Building*> m_BuildinglistEnemy;
	vector<Building*> m_Energylist;
	vector<SpikeySphere*> m_Harvesterlist;

	vector<PathFinding*> m_MakePathList;
	vector<PathFinding*> m_DefencePathList;
	vector<Soldier*> m_Soldierlist;
	vector<vector<Soldier*>> m_SoldierAttackinglist;
	vector<Soldier*> m_SoldierEnemylist;

	float m_Money, m_CostPrice, m_Time;

	int m_MaxNumberSoldiers;
	int m_NumberHouses;

	bool m_IsMainStructure, m_IsHarvester, m_IsBarracks;
	bool m_OnlyOnce;
	bool m_IsUnderAttack;
	// -------------------------
	// Disabling default copy constructor and default 
	// assignment operator.
	// -------------------------
	AI(const AI& yRef);									
	AI& operator=(const AI& yRef);	
};

 
